﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.DebuggerVisualizers;
using System.Windows.Forms;
using System.IO;
using System.Windows.Media.Imaging;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using BrushVisualizer;

[assembly: System.Diagnostics.DebuggerVisualizer(
                        typeof(BrushVisualizer.Visualizer.BrushDebuggerVisualizer),
                        typeof(BrushVisualizer.Visualizer.BrushVisualizerObjectSource),
                        Target = typeof(System.Windows.Media.Brush),
                        Description = "Brush Visualizer")]

namespace BrushVisualizer.Visualizer
{
    public class BrushDebuggerVisualizer : DialogDebuggerVisualizer
    {
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            if (windowService == null)
                throw new ArgumentNullException("windowService");
            if (objectProvider == null)
                throw new ArgumentNullException("objectProvider");

            using (var dlg = new BrushForm(objectProvider.GetData()))
            {
                windowService.ShowDialog(dlg);
            }
        }

        public static void TestShowVisualizer(object objectToVisualize)
        {
            VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(BrushDebuggerVisualizer), typeof(BrushVisualizerObjectSource));
            visualizerHost.ShowVisualizer();
        }
    }
}
